home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 3698 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.9 KB

  1. Path: bcfreenet.seflin.lib.fl.us!bcfreenet!z007400b
  2. From: z007400b@bcfreenet.seflin.lib.fl.us (Ralph Silverman)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Pound defines
  5. Date: 30 Jan 1996 18:31:19 GMT
  6. Organization: SEFLIN Free-Net - Broward
  7. Message-ID: <4elo5n$h9u@bcfreenet.seflin.lib.fl.us>
  8. References: <4dgquf$fuq@bmerhc5e.bnr.ca> <4dp5sl$9t8@spanky.pls.ov.com>
  9. NNTP-Posting-Host: bcfreenet.seflin.lib.fl.us
  10. X-Newsreader: TIN [version 1.2 PL2]
  11.  
  12. Fletcher.Glenn@ov.com (glenn@ov.com) wrote:
  13. : In article fuq@bmerhc5e.bnr.ca, studnt1@bmerhe78.bnr.ca (Jean Giblin ) writes:
  14. : >hello everyone:
  15. : >
  16. : >    I was wondering if anybody out there knows about a C command that prints the
  17. : >the name of the define when given the number. Example:
  18. : >
  19. : > #define MAX 20
  20. : >
  21. : >when given 20 it will return max.
  22. : >
  23. : >I thought a command existed, but I could be wrong.  Please respond to this newgroup,
  24. : >and not my e-mail address.
  25. : >
  26. : >    Thanks
  27. : >        Nick
  28.  
  29.  
  30. : All of the directives that start with # are C pre-processor directives.  These
  31. : directives are all resolved before compiling begins.  This means for your
  32. : example that all references to MAX are replaced with 20.  To see what I mean,
  33. : see if your compiler will output the actual source after pre-processing.
  34. : On most UNIX compilers the command is "cc -E filename.c"
  35.  
  36. : Given that the defines disappear before compiling, there is no way to work
  37. : backwards from the value.  Besides, how would one handle the following?
  38.  
  39. : #define FOO 20
  40. : #define BAR 20
  41. : #define BLECH 20
  42.  
  43. :             Fletcher.Glenn@ov.com
  44.  
  45.  
  46.  
  47. --
  48. **********begin r.s. response***********
  49.  
  50.     if your os is
  51.         (ms pc dr)dos
  52.     the 'find'
  53.     command on it can be
  54.     used if applied to the
  55.         source file
  56.     .
  57.  
  58.     in unix systems
  59.     there is a suitable
  60.     command as well.
  61.  
  62.     by the way,
  63.     frequently,
  64.     and reasonably,
  65.     more then one term is
  66.     #define
  67.     the same value...
  68.  
  69. **********end r.s. response*************
  70. Ralph Silverman
  71. z007400b@bcfreenet.seflin.lib.fl.us
  72.  
  73.